/// displayStateInfo

$.displayStateInfo = function (stateInfo) {

    var stateNameTable = {
        'Error': 'error',
        'Success': 'succ'
    };
	
	var removeStateInfoPanel = function () {
		// 如果已经有StatePanel显示，那么删之
		if ($('#state-panel')){
			$('#state-panel').remove();
		}
	};

    var getStateInfoPanel = function (stateName, stateContent) {
		
		removeStateInfoPanel();
		
		var statePanelTemplate = '<div id="state-panel" class="state-{stateName}" style="display: block;">' +
                   				    '<span>{stateContent}</span>' +
       			                    '<div class="state-panel-funcs"><a id="btnHidePanel">关闭提示</a></div>' +
            				      '</div>';
		var statePanelHtml = statePanelTemplate
								.replace('{stateName}', stateName)
								.replace('{stateContent}', stateContent);
		
								
		var statePanelDom = $(statePanelHtml).prependTo('#content-page');
		statePanelDom.find("#btnHidePanel")
			.click( removeStateInfoPanel );

        return statePanelDom;
    }

    var content = stateInfo.Info;
    var state = stateNameTable[stateInfo.State];
	
    /// main
    var newPanel = getStateInfoPanel(state, content);



	  // 不自动
      // setTimeout(function () { element.fadeOut(); }, 3000);
}




